<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width, initial-scale=1.0,maximum-scale=1.0, user-scalable=0">

		<title>订单管理</title>

		<link href="../AmazeUI-2.4.2/assets/css/admin.css" rel="stylesheet" type="text/css">
		<link href="../AmazeUI-2.4.2/assets/css/amazeui.css" rel="stylesheet" type="text/css">

		<link rel="stylesheet" href="../../js/layui/css/layui.css" media="all">

		<link href="../css/personal.css" rel="stylesheet" type="text/css">
		<link href="../css/orstyle.css" rel="stylesheet" type="text/css">

		<script src="../AmazeUI-2.4.2/assets/js/jquery.min.js"></script>
		<script src="../AmazeUI-2.4.2/assets/js/amazeui.js"></script>

	</head>

	<body>
		<!--头 -->
		<header>
			<article>
				<div class="mt-logo">
					<!--顶部导航条 -->
					<div class="am-container header">
						<ul class="message-l">
							<div class="topMessage">
								<div class="menu-hd">
									<a href="login.html" target="_top" class="h" id="login">亲，请登录</a>
									<a href="register.html" target="_top">免费注册</a>
								</div>
							</div>
						</ul>
						<ul class="message-r">
							<div class="topMessage home">
								<div class="menu-hd"><a href="home2.html" target="_top" class="h">商城首页</a></div>
							</div>
							<div class="topMessage my-shangcheng">
								<div class="menu-hd MyShangcheng"><a href="index.html" target="_top"><i class="am-icon-user am-icon-fw"></i>个人中心</a></div>
							</div>
							<div class="topMessage mini-cart">
								<div class="menu-hd"><a id="mc-menu-hd" href="shopcart.html" target="_top"><i class="am-icon-shopping-cart  am-icon-fw"></i><span>购物车</span><strong id="J_MiniCartNum" class="h">0</strong></a></div>
							</div>
							<div class="topMessage favorite">
						</ul>
						</div>

						<!--悬浮搜索框-->

						<div class="nav white">
							<div class="logoBig">
								<li><img src="../images/logobig.png" /></li>
							</div>

							<div class="search-bar pr">
								<a name="index_none_header_sysc" href="search.html"></a>
								<form action="search.html">
									<input id="searchInput" name="index_none_header_sysc" type="text" placeholder="搜索" autocomplete="off">
									<input id="ai-topsearch" class="submit am-btn" value="搜索" index="1" type="submit">
								</form>
							</div>
						</div>

						<div class="clear"></div>
					</div>
				</div>
			</article>
		</header>
            <div class="nav-table">
					   <div class="long-title"><span class="all-goods">全部分类</span></div>
					   <div class="nav-cont">
							<ul>
								<li class="index"><a href="home2.html">首页</a></li>
							</ul>
						    <div class="nav-extra">
						    	<i class="am-icon-user-secret am-icon-md nav-user"></i><b></b>我的福利
						    	<i class="am-icon-angle-right" style="padding-left: 10px;"></i>
						    </div>
						</div>
			</div>
			<b class="line"></b>
		<div class="center">
			<div class="col-main">
				<div class="main-wrap">

					<div class="user-order">

						<!--标题 -->
						<div class="am-cf am-padding">
							<div class="am-fl am-cf"><strong class="am-text-danger am-text-lg">订单管理</strong> / <small>Order</small></div>
						</div>
						<hr/>

						<div class="am-tabs am-tabs-d2 am-margin" data-am-tabs>

							<ul class="am-avg-sm-5 am-tabs-nav am-nav am-nav-tabs">
								<li class="am-active"><a href="#tab1">所有订单</a></li>
								<li><a href="#tab2" onclick="orderBy(1)">待付款</a></li>
								<li><a href="#tab3" onclick="orderBy(2)">待发货</a></li>
								<li><a href="#tab4" onclick="orderBy(3)">待收货</a></li>
								<li><a href="#tab5" onclick="orderBy(4)">待评价</a></li>
							</ul>

							<div class="am-tabs-bd">
								<div class="am-tab-panel am-fade am-in am-active" id="tab1">
									<div class="order-top">
										<div class="th th-item">
											<td class="td-inner">商品</td>
										</div>
										<div class="th th-price">
											<td class="td-inner">单价</td>
										</div>
										<div class="th th-number">
											<td class="td-inner">数量</td>
										</div>
										<div class="th th-operation">
											<td class="td-inner">商品操作</td>
										</div>
										<div class="th th-amount">
											<td class="td-inner">合计</td>
										</div>
										<div class="th th-status">
											<td class="td-inner">交易状态</td>
										</div>
										<div class="th th-change">
											<td class="td-inner">交易操作</td>
										</div>
									</div>

									<div class="order-main" >
										<div class="order-list">
											
										<div id="order_div">
										</div>
											<!--分页-->
											
										<div id="test1"></div>
										</div>

									</div>

								</div>
								<div class="am-tab-panel am-fade" id="tab2">

									<div class="order-top">
										<div class="th th-item">
											<td class="td-inner">商品</td>
										</div>
										<div class="th th-price">
											<td class="td-inner">单价</td>
										</div>
										<div class="th th-number">
											<td class="td-inner">数量</td>
										</div>
										<div class="th th-operation">
											<td class="td-inner">商品操作</td>
										</div>
										<div class="th th-amount">
											<td class="td-inner">合计</td>
										</div>
										<div class="th th-status">
											<td class="td-inner">交易状态</td>
										</div>
										<div class="th th-change">
											<td class="td-inner">交易操作</td>
										</div>
									</div>

									<div class="order-main">
										<div class="order-list" id="daifukuan">
											<!-- 待付款 -->
											待付款 
										</div>

									</div>
								</div>
								<div class="am-tab-panel am-fade" id="tab3">
									<div class="order-top">
										<div class="th th-item">
											<td class="td-inner">商品</td>
										</div>
										<div class="th th-price">
											<td class="td-inner">单价</td>
										</div>
										<div class="th th-number">
											<td class="td-inner">数量</td>
										</div>
										<div class="th th-operation">
											<td class="td-inner">商品操作</td>
										</div>
										<div class="th th-amount">
											<td class="td-inner">合计</td>
										</div>
										<div class="th th-status">
											<td class="td-inner">交易状态</td>
										</div>
										<div class="th th-change">
											<td class="td-inner">交易操作</td>
										</div>
									</div>

									<div class="order-main">
										<div class="order-list" id="daifahuo">
										<!-- 代发货 -->
										代发货 
										</div>
									</div>
								</div>
								<div class="am-tab-panel am-fade" id="tab4">
									<div class="order-top">
										<div class="th th-item">
											<td class="td-inner">商品</td>
										</div>
										<div class="th th-price">
											<td class="td-inner">单价</td>
										</div>
										<div class="th th-number">
											<td class="td-inner">数量</td>
										</div>
										<div class="th th-operation">
											<td class="td-inner">商品操作</td>
										</div>
										<div class="th th-amount">
											<td class="td-inner">合计</td>
										</div>
										<div class="th th-status">
											<td class="td-inner">交易状态</td>
										</div>
										<div class="th th-change">
											<td class="td-inner">交易操作</td>
										</div>
									</div>

									<div class="order-main">
										<div class="order-list" id="daishouhuo">
											<!-- 代收货 -->
											代收货
										</div>
									</div>
								</div>

								<div class="am-tab-panel am-fade" id="tab5">
									<div class="order-top">
										<div class="th th-item">
											<td class="td-inner">商品</td>
										</div>
										<div class="th th-price">
											<td class="td-inner">单价</td>
										</div>
										<div class="th th-number">
											<td class="td-inner">数量</td>
										</div>
										<div class="th th-operation">
											<td class="td-inner">商品操作</td>
										</div>
										<div class="th th-amount">
											<td class="td-inner">合计</td>
										</div>
										<div class="th th-status">
											<td class="td-inner">交易状态</td>
										</div>
										<div class="th th-change">
											<td class="td-inner">交易操作</td>
										</div>
									</div>

									<div class="order-main">
										<div class="order-list" id="daipingjia">
											<!--待评价	-->
												待评价
										</div>

									</div>

								</div>
							</div>

						</div>
					</div>
				</div>
				<!--底部-->
				<div class="footer">
					<div class="footer-hd">
						<p>
								<b>|</b>
								<a href="# ">商城首页</a>
								<b>|</b>
								<a href="# ">支付宝</a>
								<b>|</b>
								<a href="# ">物流</a>
							</p>
						</div>
						<div class="footer-bd ">
							<p>
								<a href="# ">合作伙伴</a>
								<a href="# ">联系我们</a>
								<a href="# ">网站地图</a>
							</p>
					</div>

				</div>
			</div>
			<aside class="menu">
				<ul>
					<li class="person active">
						<a href="index.html"><i class="am-icon-user"></i>个人中心</a>
					</li>
					<li class="person">
						<p><i class="am-icon-newspaper-o"></i>个人资料</p>
						<ul>
							<li> <a href="information.html">个人信息</a></li>
							<li> <a href="safety.html">安全设置</a></li>
							<li> <a href="address.html">地址管理</a></li>
							<li> <a href="cardlist.html">快捷支付</a></li>
						</ul>
					</li>
					<li class="person">
						<p><i class="am-icon-balance-scale"></i>我的交易</p>
						<ul>
							<li><a href="order.html">订单管理</a></li>
							<li> <a href="change.html">退款售后</a></li>
							<li> <a href="comment.html">评价商品</a></li>
						</ul>
					</li>
					<li class="person">
						<p><i class="am-icon-dollar"></i>我的资产</p>
						<ul>
							<li> <a href="points.html">我的积分</a></li>
							<li> <a href="coupon.html">优惠券 </a></li>
							<li> <a href="bonus.html">红包</a></li>
							<li> <a href="walletlist.html">账户余额</a></li>
							<li> <a href="bill.html">账单明细</a></li>
						</ul>
					</li>

					<li class="person">
						<p><i class="am-icon-tags"></i>我的收藏</p>
						<ul>
							<li> <a href="collection.html">收藏</a></li>
							<li> <a href="foot.html">足迹</a></li>
						</ul>
					</li>

					<li class="person">
						<p><i class="am-icon-qq"></i>在线客服</p>
						<ul>
							<li> <a href="consultation.html">商品咨询</a></li>
							<li> <a href="suggest.html">意见反馈</a></li>							
							
							<li> <a href="news.html">我的消息</a></li>
						</ul>
					</li>
				</ul>

			</aside>
		</div>

<script src="../../js/layui/layui.js"></script>
<script type="text/javascript">
//点击事件
 function orderBy(i){
	
} 
var currentpage = 0;//初始page
layui.use('laypage', function(){
	  var laypage = layui.laypage;
	  
	  //执行一个laypage实例
	  laypage.render({
	    elem: 'test1' //注意，这里的 test1 是 ID，不用加 # 号
	    ,count: 30//数据总数，从服务端得到
	    ,limit:5
	    ,jump: function(obj, first){
	    	 //obj包含了当前分页的所有参数，比如：
	        //console.log(obj.curr); //得到当前页，以便向服务端请求对应页的数据。
	        //console.log(obj.limit); //得到每页显示的条数
	        
		$.post("../../order_ViewAllBypage",{order_user_id:localStorage.getItem("user_id"),page:obj.curr,limit:obj.limit},function(res){
			if(res!=null){
				$("#order_div").html("");
				console.log(res[0].product_img);
				console.log(res);
				for (var i = 0; i < res.length; i++) {
					 $("#order_div").append(`
								<!--交易成功-->
								<div class="order-status5">
									<div class="order-title">
										<div class="dd-num">
											订单编号：<a href="javascript:;">${res[i].order_on}</a>
										</div>
										<span>成交时间：${res[i].order_time}</span>
										<!--    <em>店铺：小桔灯</em>-->
									</div>
									<div class="order-content">
										<div class="order-left">
											<ul class="item-list">
												<li class="td td-item">
													<div class="item-pic">
														<a href="#" class="J_MakePoint"> <img
															src="../../static/admin/images/${res[i].product_img}"
															class="itempic J_ItemImg">
														</a>
													</div>
													<div class="item-info">
														<div class="item-basic-info">
															<a href="#">
																<p>${res[i].product_name}</p>
																<p class="info-little">
																	颜色：12#远峰蓝 <br />描述：${res[i].product_content}
																</p>
															</a>
														</div>
													</div>
												</li>
												<li class="td td-price">
													<div class="item-price"></div>
												</li>
												<li class="td td-number">
													<div class="item-number">
														<span>×</span>2
													</div>
												</li>
												<li class="td td-operation">
													<div class="item-operation"></div>
												</li>
											</ul>




										</div>
										<div class="order-right">
											<li class="td td-amount">
												<div class="item-amount">
													合计：<span>${res[i].product_price}</span>
													<p>
														含运费：<span>${res[i].order_money}</span>
													</p>
												</div>
											</li>
											<div class="move-right">
												<li class="td td-status">
													<div class="item-status">
														<p class="Mystatus">交易成功</p>
														<p class="order-info">
															<a href="orderinfo.html">订单详情</a>
														</p>
														<p class="order-info">
															<a href="logistics.html">查看物流</a>
														</p>
													</div>
												</li>
												<li class="td td-change" onclick="delorder(${res[i].order_id})">
													<div class="am-btn am-btn-danger anniu">删除订单</div>
												</li>
											</div>
										</div>
									</div>
								</div> 	
					`);  
					 
					/*  $("#delete").click(function(){
						 $.post("../../addressDelete",{address_id:i},function(res){
							 
						 },"json");
					 }) */
				}
			}else{
				alert("查询失败");
			}
    		
				
			},"json");
	        
	       
	      }
	
	    
	  });
	});
//删除订单
	function delorder(i){
		$.post("../../orderDelete",{order_id:i},function(res){
			if (res.code=="0") {
				alert("删除订单成功");
				window.location.reload();
			} else {
				alert("删除订单失败");
			}
		},"json");	
	}	
	
	
	
	</script>
	

<script type="text/javascript">
//待付款
$(function(){
	var user_id = localStorage.getItem("user_id");
	var order_spare1 = 1;
		$.post("../../order_ViewAlls",{order_user_id:user_id,order_spare1:order_spare1},function(res){
			for (var i = 0; i < res.length; i++) {
				 $("#daifukuan").append(`
							<!--交易成功-->
							<div class="order-status5">
								<div class="order-title">
									<div class="dd-num">
										订单编号：<a href="javascript:;">${res[i].order_on}</a>
									</div>
									<span>成交时间：${res[i].order_time}</span>
								</div>
								<div class="order-content">
									<div class="order-left">
										<ul class="item-list">
											<li class="td td-item">
												<div class="item-pic">
													<a href="#" class="J_MakePoint"> <img
														src="../../static/admin/images/${res[i].product_img}"
														class="itempic J_ItemImg">
													</a>
												</div>
												<div class="item-info">
													<div class="item-basic-info">
														<a href="#">
															<p>${res[i].product_name}</p>
															<p class="info-little">
																颜色：12#远峰蓝 <br />描述：${res[i].product_content}
															</p>
														</a>
													</div>
												</div>
											</li>
											<li class="td td-price">
												<div class="item-price"></div>
											</li>
											<li class="td td-number">
												<div class="item-number">
													<span>×</span>2
												</div>
											</li>
											<li class="td td-operation">
												<div class="item-operation"></div>
											</li>
										</ul>




									</div>
									<div class="order-right">
										<li class="td td-amount">
											<div class="item-amount">
												合计：<span>${res[i].product_price}</span>
												<p>
													含运费：<span>${res[i].order_money}</span>
												</p>
											</div>
										</li>
										<div class="move-right">
										<li class="td td-status">
											<div class="item-status">
												<p class="Mystatus">等待买家付款</p>
												<p class="order-info"><a href="#">取消订单</a></p>

											</div>
										</li>
										<li class="td td-change">
											<a href="javascript:;" onclick="zhifu(${res[i].order_id},${res[i].product_price})">
											<div class="am-btn am-btn-danger anniu">
												一键支付</div></a>
										</li>
									</div>
									</div>
								</div>
							</div> 	
				`);  
				 
				
			}
			
		},"json");
	});

	function zhifu(i,j){
		$.post("../../orderUpdateBy1",{order_spare1:2,order_id:i},function(res){
			if (res.code=="0") {
				$(location).attr("href","success.html?zongjia="+j);
				
			} else {
				alert("支付异常");
			}
		},"json");
	}
</script>
<script type="text/javascript">
//代发货
$(function(){
	
	var user_id = localStorage.getItem("user_id");
	var order_spare1 = 2;
		$.post("../../order_ViewAlls",{order_user_id:user_id,order_spare1:order_spare1},function(res){
			for (var i = 0; i < res.length; i++) {
				 $("#daifahuo").append(`
							<!--交易成功-->
							<div class="order-status5">
								<div class="order-title">
									<div class="dd-num">
										订单编号：<a href="javascript:;">${res[i].order_on}</a>
									</div>
									<span>成交时间：${res[i].order_time}</span>
								</div>
								<div class="order-content">
									<div class="order-left">
										<ul class="item-list">
											<li class="td td-item">
												<div class="item-pic">
													<a href="#" class="J_MakePoint"> <img
														src="../../static/admin/images/${res[i].product_img}"
														class="itempic J_ItemImg">
													</a>
												</div>
												<div class="item-info">
													<div class="item-basic-info">
														<a href="#">
															<p>${res[i].product_name}</p>
															<p class="info-little">
																颜色：12#远峰蓝 <br />描述：${res[i].product_content}
															</p>
														</a>
													</div>
												</div>
											</li>
											<li class="td td-price">
												<div class="item-price"></div>
											</li>
											<li class="td td-number">
												<div class="item-number">
													<span>×</span>2
												</div>
											</li>
											<li class="td td-operation">
												<div class="item-operation"></div>
											</li>
										</ul>




									</div>
									<div class="order-right">
										<li class="td td-amount">
											<div class="item-amount">
												合计：<span>${res[i].product_price}</span>
												<p>
													含运费：<span>${res[i].order_money}</span>
												</p>
											</div>
										</li>
										<div class="move-right">
										<li class="td td-status">
											<div class="item-status">
												<p class="Mystatus">买家已付款</p>
												<p class="order-info"><a href="orderinfo.html">订单详情</a></p>
											</div>
										</li>
										<li class="td td-change" onclick="alert('提醒发货成功')">
											<div class="am-btn am-btn-danger anniu">
												提醒发货</div>
										</li>
									</div>
									</div>
								</div>
							</div> 	
				`);  
				 
				
			}
			
		},"json");
	});

</script>
<script type="text/javascript">
//待收货
$(function(){
	var user_id = localStorage.getItem("user_id");
	var order_spare1 = 3;
		$.post("../../order_ViewAlls",{order_user_id:user_id,order_spare1:order_spare1},function(res){
			for (var i = 0; i < res.length; i++) {
				 $("#daishouhuo").append(`
							<!--交易成功-->
							<div class="order-status5">
								<div class="order-title">
									<div class="dd-num">
										订单编号：<a href="javascript:;">${res[i].order_on}</a>
									</div>
									<span>成交时间： ${res[i].order_time}</span>
								</div>
								<div class="order-content">
									<div class="order-left">
										<ul class="item-list">
											<li class="td td-item">
												<div class="item-pic">
													<a href="#" class="J_MakePoint"> <img
														src="../../static/admin/images/${res[i].product_img}"
														class="itempic J_ItemImg">
													</a>
												</div>
												<div class="item-info">
													<div class="item-basic-info">
														<a href="#">
															<p>${res[i].product_name}</p>
															<p class="info-little">
																颜色：12#远峰蓝 <br />描述：${res[i].product_content}
															</p>
														</a>
													</div>
												</div>
											</li>
											<li class="td td-price">
												<div class="item-price"></div>
											</li>
											<li class="td td-number">
												<div class="item-number">
													<span>×</span>2
												</div>
											</li>
											<li class="td td-operation">
												<div class="item-operation"></div>
											</li>
										</ul>




									</div>
									<div class="order-right">
										<li class="td td-amount">
											<div class="item-amount">
												合计：<span>${res[i].product_price}</span>
												<p>
													含运费：<span>${res[i].order_money}</span>
												</p>
											</div>
										</li>
										<div class="move-right">
										<li class="td td-status">
											<div class="item-status">
												<p class="Mystatus">卖家已发货</p>
												<p class="order-info"><a href="orderinfo.html">订单详情</a></p>
												<p class="order-info"><a href="logistics.html">查看物流</a></p>
												<p class="order-info"><a href="#">延长收货</a></p>
											</div>
										</li>
										<li class="td td-change">
											<div class="am-btn am-btn-danger anniu" onclick="shouhuo(${res[i].order_id})">
												确认收货</div>
										</li>
									</div>
									</div>
								</div>
							</div> 	
				`);  
				 
				
			}
			
		},"json");
		
	});
function shouhuo(shouhuo){
	$.post("../../orderUpdateBy1",{order_spare1:4,order_id:shouhuo},function(res){
		if (res.code=="0") {
			alert("收货成功,可以对该商品进行评价");
			location.reload();
		} else {
			alert("收货异常");
		}
	},"json");
}
</script>
<script type="text/javascript">
//代评价
$(function(){
	var user_id = localStorage.getItem("user_id");
	var order_spare1 = 4;
		$.post("../../order_ViewAlls",{order_user_id:user_id,order_spare1:order_spare1},function(res){
			for (var i = 0; i < res.length; i++) {
				 $("#daipingjia").append(`
							<!--交易成功-->
							<div class="order-status5">
								<div class="order-title">
									<div class="dd-num">
										订单编号：<a href="javascript:;">${res[i].order_on}</a>
									</div>
									<span>成交时间：${res[i].order_time}</span>
								</div>
								<div class="order-content">
									<div class="order-left">
										<ul class="item-list">
											<li class="td td-item">
												<div class="item-pic">
													<a href="#" class="J_MakePoint"> <img
														src="../../static/admin/images/${res[i].product_img}"
														class="itempic J_ItemImg">
													</a>
												</div>
												<div class="item-info">
													<div class="item-basic-info">
														<a href="#">
															<p>${res[i].product_name}</p>
															<p class="info-little">
																颜色：12#远峰蓝 <br />描述：${res[i].product_content}
															</p>
														</a>
													</div>
												</div>
											</li>
											<li class="td td-price">
												<div class="item-price"></div>
											</li>
											<li class="td td-number">
												<div class="item-number">
													<span>×</span>2
												</div>
											</li>
											<li class="td td-operation">
												<div class="item-operation"></div>
											</li>
										</ul>




									</div>
									<div class="order-right">
										<li class="td td-amount">
											<div class="item-amount">
												合计：<span>${res[i].product_price}</span>
												<p>
													含运费：<span>${res[i].order_money}</span>
												</p>
											</div>
										</li>
										<div class="move-right">
										<li class="td td-status">
											<div class="item-status">
												<p class="Mystatus">交易成功</p>
												<p class="order-info"><a href="orderinfo.html">订单详情</a></p>
												<p class="order-info"><a href="logistics.html">查看物流</a></p>
											</div>
										</li>
										<li class="td td-change">
											<a href="javascript:;" onclick="pingjia(${res[i].order_id})">
												<div class="am-btn am-btn-danger anniu">
													评价商品</div>
											</a>
										</li>
									</div>
									</div>
								</div>
							</div> 	
				`);  
				 
				
			}
			
		},"json");
	});
function pingjia(i){
	$.post("../../orderUpdateBy1",{order_spare1:5,order_id:i},function(res){
		if (res.code=="0") {
			$(location).attr("href","commentlist.html?order_id="+i);
			
		} else {
			alert("支付异常");
		}
	},"json");
	
}
</script>
<script type="text/javascript">
if (localStorage.getItem("user_id")!=null) {
	$("#login").html(localStorage.getItem("user_fullname"));
}else{
	$("#login").html("请登录");
}
</script>
	</body>

</html>